<?php

namespace app\console\controller;

use think\facade\Session;
use think\facade\Request;
use app\console\model\Admin as AdminModel;
use think\Controller;

/**
 * controller基类
 * */
class Base extends Controller
{
    protected $left_bar;//左侧导航
    protected $request;

    public function __construct()
    {
        parent::__construct();

        Session::has('consoler', 'console') == false && $this->redirect('login/userlogin');
        define('ADMIN_ID', Session::get('consoler.id', 'console'));

        $this->left_bar = AdminModel::user_left_bar();//左侧导航栏
        $this->request = Request::instance();

        $this->assign([
            'left_bar' => $this->left_bar,
            'id' => ADMIN_ID,
        ]);
    }
}
